package com.itlong.cloud.user.app;

import com.itlong.cloud.POJO.DTO.app.AppFaceRecognitionPaymentDTO;
import com.itlong.cloud.POJO.DTO.app.AppTouristDTO;
import com.itlong.cloud.POJO.DTO.app.AppUserRegisterDTO;
import com.itlong.cloud.POJO.PO.AppUserInfoPO;
import com.itlong.cloud.POJO.PO.GuestUserHistoryPO;
import com.itlong.cloud.POJO.VO.MessageVO;
import com.itlong.cloud.POJO.PO.CloudIntercomAccountInfoPO;
import com.itlong.cloud.POJO.VO.app.AppUserCacheVO;
import com.itlong.cloud.POJO.VO.app.AppUserOwnProjectVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;
import java.util.List;
import java.util.Map;

/**
 *<desc>
 *     新版APP的登录与注册版块接口代理
 *</desc>
 *
 * @createDate 2017/9/19.
 */
@FeignClient(name="user-service")
public interface IAppRegisterServiceClient {

    /**
     * <desc>
     *      根据手机号检测APP当前用户是否已存在
     * </desc>
     * @param phoneNo  手机号
     * @return true-是，false-否
     * @author cuiduanwu
     * @createDate 2017/09/21
     */
    @RequestMapping(path = "/app/user/checkUserByPhoneNo",method = RequestMethod.POST)
    boolean checkUserByPhoneNo(@RequestParam("phoneNo") String phoneNo);

    /**
     * <desc>
     *     根据手机号查询用户
     * </desc>
     * @param phoneNo
     * @return
     * @author cuiduanwu
     * @createDate 2017/09/21
     */
    @RequestMapping(path = "/app/user/getUserByPhoneNo",method = RequestMethod.POST)
    AppUserInfoPO getUserByPhoneNo(@RequestParam("phoneNo") String phoneNo);

    /**
     * <desc>
     *     根据邮箱查询用户
     * </desc>
     * @param email
     * @return
     * @author shengen.T
     * @createDate 2017/09/21
     */
    @RequestMapping(path = "/app/user/getUserByEmail",method = RequestMethod.POST)
    AppUserInfoPO getUserByEmail(@RequestParam("email") String email);

    /**
     * <desc>
     *     APP端用户注册提交验证
     * </desc>
     *
     * @param appUserRegisterDTO
     * @return
     * @author cuiduanwu
     * @createDate 2017/9/24
     */
    @RequestMapping(path = "/app/user/registerUser",method = RequestMethod.POST)
    boolean registerUser(@RequestBody AppUserRegisterDTO appUserRegisterDTO) throws  Exception;


    /**
     * <desc>
     *     APP端更新用户密码
     * </desc>
     *
     * @param phoneNo 手机号或邮箱
     * @param pswd 新密码
     * @param mode 0-手机号，1-邮箱
     * @return true -成功，false-失败
     * @author cuiduanwu
     * @throws Exception
     * @createDate 2017/9/24
     */
    @RequestMapping(path = "/app/user/updateUserPswd",method = RequestMethod.POST)
    boolean updateUserPswd(@RequestParam("phoneNo") String phoneNo, @RequestParam("pswd") String pswd, @RequestParam("mode") String mode) throws  Exception;

    /**
     * <desc>
     *     APP端用户登录
     * </desc>
     * @param phoneNo
     * @param pswd
     * @return
     * @author cuiduanwu
     * @throws Exception
     * @createDate 2017/9/24
     */
    @RequestMapping(path = "/app/user/login",method = RequestMethod.POST)
    AppUserCacheVO appUserLogin(@RequestParam("phoneNo") String phoneNo, @RequestParam("pswd") String pswd,@RequestParam("loginDevice") String loginDevice) throws  Exception;

    /**
     * <desc>
     *     APP端用户邮箱登录
     * </desc>
     * @param email
     * @param pswd
     * @return
     * @author shengen.T
     * @throws Exception
     * @createDate 2017/12/27
     */
    @RequestMapping(path = "/app/user/loginByEmail",method = RequestMethod.POST)
    AppUserCacheVO appUserLoginByEmail(@RequestParam("email") String email, @RequestParam("pswd") String pswd,@RequestParam("loginDevice") String loginDevice) throws  Exception;

    /**
     * <desc>
     *     APP端登录获取用户项目列表信息
     * </desc>
     *
     * @param userId  用户ID
     * @param deviceType 设备类型 1-安卓系统，2-ios系统
     * @return  APP用户所拥有的项目配置信息的集合
     * @throws Exception
     * @author cuiduanwu
     * @createDate 2017/9/27
     */
    @RequestMapping(path = "/app/user/getUserOwnProjectsInfo",method = RequestMethod.POST)
    List<AppUserOwnProjectVO> getUserOwnProjectsInfo(@RequestParam("userId") String userId,@RequestParam("deviceType") String deviceType) throws  Exception;

    /**
     * <desc>
     *     APP端登录后缓存用户信息
     * </desc>
     * @param appUserCacheVO
     * @return
     * @author cuiduanwu
     * @createDate 2017/9/27
     */
    @RequestMapping(path = "/app/user/loginCacheUserVO",method = RequestMethod.POST)
    boolean loginCacheUserVO(@RequestBody AppUserCacheVO appUserCacheVO) throws Exception;

    /**
     * <desc>
     *     根据userId和projectId查询该用户是否欠费
     * </desc>
     * @param projectId 项目编号
     * @param userId 用户Id
     * @return
     * @author Juguang.S
     * @createDate 2019/01/22
     */
    @RequestMapping(path = "/app/user/getUserIsForbidden",method = RequestMethod.POST)
    Integer getUserIsForbidden(@RequestParam("projectId") String projectId,@RequestParam("userId") String userId) throws Exception;

    /**
     * <desc>
     *     根据userId和projectId查询该用户是否欠费
     * </desc>
     *
     * @param paymentDTO
     * @return
     * @author Jiaqi.X
     * @createDate 2019/06/21
     */
    @RequestMapping(path = "/app/user/getPadUserForbidden",method = RequestMethod.POST)
    Integer getPadUserForbidden(@RequestBody AppFaceRecognitionPaymentDTO paymentDTO) throws Exception;

    /**
     * <desc>
     *      查询pad用户欠费状态
     * </desc>
     *
     * @param paymentDTO
     * @return
     * @author Jiaqi.X
     * @createDate 2019/06/21
     */
    @RequestMapping(path = "/app/user/getPadUserStatus",method = RequestMethod.POST)
    Map<String,Object> getPadUserStatus(@RequestBody AppFaceRecognitionPaymentDTO paymentDTO) throws ParseException;

    /**
     * <desc>
     *      APP端登录根据用户ID与项目编号获取房间总数或业主房间总数
     * </desc>
     *
     * @param userId 用户id
     * @param projectId 项目id
     * @return
     * @throws Exception
     * @createDate 2017/9/28
     */
    @RequestMapping(path = "/app/user/countUserAttacheInfoInProject",method = RequestMethod.POST)
    Integer countUserAttacheInfoInProject(@RequestParam("userId") String userId,@RequestParam("projectId") String projectId);

    /**
     * <desc>
     *      通过userid获取用户基本信息
     * </desc>
     * @param userId 用户id
     * @return
     * @author Jiaqi.X
     * @createDate 2017/12/22
     */
    @RequestMapping(path = "/app/user/getBaseUserInfo",method = RequestMethod.POST)
    AppUserInfoPO getBaseUserInfo(@RequestParam("userId") String userId);

    /**
     * <desc>
     *     根据APP端用户的操作日志来自动更新用户Token缓存
     * </desc>
     * @return
     * @author cuiduanwu
     * @createDate 2018/1/18
     */
    @RequestMapping(path = "/timeTask/app/userTokenUpdate",method = RequestMethod.POST)
    boolean  timeTaskOfUserTokenUpdate() throws Exception;

    /**
     * <desc>
     *     根据userId查询当前用户是否有人脸
     * </desc>
     * @return
     * @author Juguang.S
     * @createDate 2018/4/24
     */
    @RequestMapping(path = "/app/getIsFace",method = RequestMethod.POST)
    Integer getIsFace(@RequestParam("userId") String userId) throws Exception;

    /**
     * <desc>
     *     根据cardId查询当前用户
     * </desc>
     * @return
     * @author Juguang.S
     * @createDate 2018/4/24
     */
    @RequestMapping(path = "/app/getCardUserId",method = RequestMethod.POST)
    String getCardUserId(@RequestParam("cardId") String cardId) throws Exception;

    /**
     * <desc>
     *     检查当前账号是否被锁定
     * </desc>
     * @param phoneNo 手机号
     * @return
     * @author Juguang.S
     * @createDate 2018/10/16
     */
    @PostMapping(path = "/app/getAppAccountLockDetail")
    MessageVO getAppAccountLockDetail(@RequestParam("phoneNo") String phoneNo);

    /**
     * <desc>
     *      App登录错误处理
     * <desc/>
     * @param   phoneNo    手机号
     * @return  标准化响应结果
     * @author Juguang.S
     * @createDate 2018/10/16
     */
    @PostMapping(path = "/app/loginErrorHandler")
    MessageVO loginErrorHandler(@RequestParam("phoneNo") String phoneNo,@RequestParam("language")String language);


    /**
     * <desc>
     *      获取用户的第三方账号信息
     * </desc>
     *
     * @param cloudIntercomAccountId 第三方提供账号表的逻辑主键
     * @return 第三方账号信息
     * @author wangzhi
     * @createDate 2018/07/17
     */
    @RequestMapping(path = "/app/user/getClientAccount",method = RequestMethod.POST)
    CloudIntercomAccountInfoPO getClientAccount(@RequestParam("cloudIntercomAccountId") String cloudIntercomAccountId);

    /**
     * <desc>
     *      获取用户消息状态和欠费房间id
     * </desc>
     *
     * @param currentProjectId 当前项目编号
     * @param userId 用户id
     * @return 用户消息状态和欠费房间id
     * @author wangzhi
     * @createDate 2019/05/29
     */
    @RequestMapping(path = "/app/user/getUserMsgAndRoomId",method = RequestMethod.POST)
    AppUserCacheVO getUserMsgAndRoomId(@RequestParam("currentProjectId") String currentProjectId, @RequestParam("userId") String userId,
                                       @RequestParam(value = "version", required = false) String version) throws Exception;

    /**
     * <desc>
     *      根据userId 登录密码校验密码的正确性
     * </desc>
     *
     * @param userId 用户id
     * @param loginPwd 登录密码
     * @return
     * @throws Exception
     * @createDate 2019/9/17
     */
    @RequestMapping(path = "/app/user/checkLoginPwd",method = RequestMethod.POST)
    Integer checkLoginPwd(@RequestParam("userId") String userId,@RequestParam("loginPwd") String loginPwd);

    /**
     * <desc>
     *      游客登录
     * </desc>
     *
     * @return 登录信息
     * @author wangzhi
     * @createDate 2020/04/30
     */
    @RequestMapping(path = "/app/user/touristLogin", method = RequestMethod.POST)
    Map<String, Object> touristLogin(@RequestBody AppTouristDTO appTouristDTO) throws Exception;

    /**
     * <desc>
     *      保存游客项目历史信息
     * </desc>
     *
     * @return 受影响行数
     * @author wangzhi
     * @createDate 2020/05/12
     */
    @RequestMapping(path = "/app/user/saveOrUpdateGuestProject", method = RequestMethod.POST)
    Integer saveOrUpdateGuestProject(@RequestBody GuestUserHistoryPO guestUserHistoryPO) throws Exception;

    /**
     * <desc>
     *      获取游客项目信息
     * </desc>
     *
     * @return 游客项目信息
     * @author wangzhi
     * @createDate 2020/05/18
     */
    @RequestMapping(path = "/app/user/getGuestProject", method = RequestMethod.POST)
    AppUserOwnProjectVO getGuestProject(@RequestParam("projectId") String projectId) throws Exception;

    /**
     * <desc>
     *      查询用户在项目下是否被禁用
     * </desc>
     *
     * @param userId 用户id
     * @param projectId 项目id
     * @return
     * @throws Exception
     * @createDate 2020/11/23
     */
    @RequestMapping(path = "/app/user/getUserStatusByProjectId",method = RequestMethod.POST)
    Integer getUserStatusByProjectId(@RequestParam("userId") String userId,@RequestParam("projectId") String projectId);
}
